package com.kifas.entity;

import java.io.Serializable;
import java.util.Date;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@Table(name = "tb_customer")
public class CustomerEntity implements Serializable {

	private static final long serialVersionUID = -2740681510754152242L;

	@Id
	@GeneratedValue
	@Column(name = "id_customer")
	private Long idCustomer;

	@Column(length = 45)
	private String nama;

	@Column(length = 100)
	private String alamat1;

	@Column(length = 100)
	private String alamat2;

	@Column(length = 100)
	private String alamat3;

	@Column(name = "notelp")
	private String noTelp;

	@Column(name = "notelp1")
	private String noTelp1;

	@Column(name = "notelp2")
	private String noTelp2;

	@Column(length = 45)
	private String email;

	@Column(length = 45)
	private String contactPerson;

	@Column(length = 45)
	private String contactPerson1;

	private String fax;

	private String npwp;

	private String bank_acc;

	@Temporal(TemporalType.TIMESTAMP)
	private Date tgl_entry;

	@OneToMany(mappedBy = "customer", targetEntity = PenjualanEntity.class, fetch = FetchType.LAZY)
	private Set<PenjualanEntity> penjualans;

	@ManyToOne
	@JoinColumn(name = "id_jenis_customer", nullable = false)
	private JenisCustomerEntity jenisCustomer;

	@ManyToOne
	@JoinColumn(name = "id_sales", nullable = false)
	private SalesEntity sales;
	
	@Column(name= "created_by")
	private String createdBy;

	public CustomerEntity() {
	}

	public CustomerEntity(Long idCustomer, String nama, String alamat1, String alamat2, String noTelp, String email, String contactPerson,
			JenisCustomerEntity jenisCustomer, String alamat3, String noTelp1, String noTelp2, String contactPerson1, String fax, String npwp, String bank_acc,
			Date tgl_entry, SalesEntity sales, String createdBy) {
		this.idCustomer = idCustomer;
		this.nama = nama;
		this.alamat1 = alamat1;
		this.alamat2 = alamat2;
		this.noTelp = noTelp;
		this.email = email;
		this.contactPerson = contactPerson;
		this.jenisCustomer = jenisCustomer;
		this.alamat3 = alamat3;
		this.noTelp1 = noTelp1;
		this.noTelp2 = noTelp2;
		this.contactPerson1 = contactPerson1;
		this.fax = fax;
		this.npwp = npwp;
		this.bank_acc = bank_acc;
		this.tgl_entry = tgl_entry;
		this.sales = sales;
		this.createdBy = createdBy;
	}

	public SalesEntity getSales() {
		return sales;
	}

	public void setSales(SalesEntity sales) {
		this.sales = sales;
	}

	public String getAlamat3() {
		return alamat3;
	}

	public void setAlamat3(String alamat3) {
		this.alamat3 = alamat3;
	}

	public String getBank_acc() {
		return bank_acc;
	}

	public void setBank_acc(String bank_acc) {
		this.bank_acc = bank_acc;
	}

	public String getContactPerson1() {
		return contactPerson1;
	}

	public void setContactPerson1(String contactPerson1) {
		this.contactPerson1 = contactPerson1;
	}

	public String getFax() {
		return fax;
	}

	public void setFax(String fax) {
		this.fax = fax;
	}

	public String getNoTelp1() {
		return noTelp1;
	}

	public void setNoTelp1(String noTelp1) {
		this.noTelp1 = noTelp1;
	}

	public String getNoTelp2() {
		return noTelp2;
	}

	public void setNoTelp2(String noTelp2) {
		this.noTelp2 = noTelp2;
	}

	public String getNpwp() {
		return npwp;
	}

	public void setNpwp(String npwp) {
		this.npwp = npwp;
	}

	public Date getTgl_entry() {
		return tgl_entry;
	}

	public void setTgl_entry(Date tgl_entry) {
		this.tgl_entry = tgl_entry;
	}

	public Long getIdCustomer() {
		return idCustomer;
	}

	public void setIdCustomer(Long idCustomer) {
		this.idCustomer = idCustomer;
	}

	public String getNama() {
		return nama;
	}

	public void setNama(String nama) {
		this.nama = nama;
	}

	public String getAlamat1() {
		return alamat1;
	}

	public void setAlamat1(String alamat1) {
		this.alamat1 = alamat1;
	}

	public String getAlamat2() {
		return alamat2;
	}

	public void setAlamat2(String alamat2) {
		this.alamat2 = alamat2;
	}

	public String getNoTelp() {
		return noTelp;
	}

	public void setNoTelp(String noTelp) {
		this.noTelp = noTelp;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getContactPerson() {
		return contactPerson;
	}

	public void setContactPerson(String contactPerson) {
		this.contactPerson = contactPerson;
	}

	public Set<PenjualanEntity> getPenjualans() {
		return penjualans;
	}

	public void setPenjualans(Set<PenjualanEntity> penjualans) {
		this.penjualans = penjualans;
	}

	public JenisCustomerEntity getJenisCustomer() {
		return jenisCustomer;
	}

	public void setJenisCustomer(JenisCustomerEntity jenisCustomer) {
		this.jenisCustomer = jenisCustomer;
	}

	public void setCreatedBy(String createdBy) {
		this.createdBy = createdBy;
	}

	public String getCreatedBy() {
		return createdBy;
	}

}
